﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Panel_Win : BasePanel
{
    public Text textLevel;
    public Text textAward;


    public override void OnEnter()
    {
        base.OnEnter();
        gameObject.SetActive(true);
        WinPanelShow();
    }
    public override void OnExit()
    {
        base.OnExit();
        gameObject.SetActive(false);

    }
    public override void OnPause()
    {
        base.OnPause();
    }
    public override void OnResume()
    {
        base.OnResume();
    }

    private void Update()
    {
        if (Input.GetButtonDown("Cancel"))
        {
            GameControl.instance.GameOver();
            UIManager.Instance.PopPanel();
        }
    }

    /// <summary>
    /// 退出游戏胜利界面
    /// </summary>
    public void Button_Close()
    {
        UIManager.Instance.PopPanel();

    }

    /// <summary>
    /// 在胜利界面开启下一关
    /// </summary>
    public void Button_NextStart()
    {
        UIManager.Instance.PopPanel();
        GameControl.instance.GameBegin();
    }

    public void WinPanelShow()
    {
        int levelNum = User.instance.CurLevel;
        textLevel.text = (levelNum + 1).ToString();
        textAward.text = ((levelNum / 10 + 1) * 100).ToString();
    }

}
